﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace Manager_personnel.account
{
    public partial class register : Form
    {
        public register()
        {
            InitializeComponent();
            btnregister.Click += new EventHandler(btnregister_Click);
        }

        void btnregister_Click(object sender, EventArgs e)
        {
            string name = txtname.Text;
            string username = txtusername.Text;
            string pass = txtpass.Text;
            string email = txtemail.Text;
            try
            {
                if (name == "" || username == "" || pass == "" || email == "")
                {
                    MessageBox.Show("Please check info account after register");
                    txtname.Focus();
                }
                else
                {
                    clsdulieu clsdata = new clsdulieu();
                    if (clsdata.sign_in(username, pass, email, name) == true)
                    {
                        login login = new login();
                        this.Hide();
                        login.ShowDialog();
                      

                    }
                    else
                    {
                        MessageBox.Show("trùng khóa");
                        txtname.Text = "";
                        txtusername.Text = "";
                        txtemail.Text = "";
                        txtpass.Text = "";
                        txtname.Focus();
                    }
                }

            }
            catch (Exception error)
            { }
        }
    }
}
